import 'package:aio/aio.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:app/generated/app_strings.dart';
import 'package:app/src/http/bean/http_data.dart';
import 'package:app/src/http/bean/wroks/address_bean.dart';
import 'package:app/src/http/bean/wroks/contract_bean.dart';
import 'package:app/src/ui/app_ui.dart';
import 'package:app/src/ui/route/helper/route_helper.dart';
import 'package:app/src/ui/route/works/public/items/ui_base.dart';
import 'package:app/src/ui/route/works/public/items/ui_card.dart';

import '../../../../../http/bean/works_2023/purcontract_bean.dart';
import '../../../../../http/bean/works_2023/purorderInfo_bean.dart';
import '../../../../../http/bean/works_2023/transport_bean.dart';
import '../../../../../http/bean/worksdo/material_requisition_bean.dart';
import '../../../../../http/bean/wroks/dispatchingaudit_bean.dart';
import '../../../../../http/bean/ywx_limit.dart';
import '../../../../../http/model/config_model.dart';
import '../../../../dialog/dailog.dart';

///运输合同审核：基本信息
class UiTransportAudit {
  ///data 信息
  ///oldData 历史信息
  static Widget build(BuildContext context, YwxItem item, LogisticsContractBean? data,
      LogisticsContractBean? oldData, StateSetter setState,
      {String? title}) {
    if (data == null) {
      return AppUi.getEmptyView();
    }
    UiBase.setWidth();
    List<Widget> children = [];
    if (StringUtils.isEmpty(title)) {
      title = AppStrings.of(context).Transportinformation; //运输合同信息
    }
    var isGrey = false;
    children.add(UiBase.title(context, title)); //标题
    children.add(UiBase.item(context, AppStrings.of(context).LContractCode,
        data?.LContractCode, oldData?.LContractCode,
        isAllowEmpty: true, isGrey: isGrey)); //运输合同号
    children.add(UiBase.item(context, AppStrings.of(context).CarrierName,
        data?.CarrierName, oldData?.CarrierName,
        isAllowEmpty: true,
        isBlue: false,
        isGrey: isGrey,
        isStart: true)); //承运商 1
    children.add(UiBase.item(context, AppStrings.of(context).LOutCode,
        data?.LOutCode, oldData?.LOutCode,
        isAllowEmpty: true,
        isBlue: false,
        isGrey: isGrey,
        isStart: false)); //运输合同外部编号
    children.add(UiBase.item(context, AppStrings.of(context).PersonName8,
        data?.createrName, oldData?.createrName,
        isAllowEmpty: true,
        isBlue: false,
        isGrey: isGrey,
        isStart: false)); //创建人
    children.add(UiBase.item(context, AppStrings.of(context).CreaterDateTime,
        data?.getCreaterDateTime(), oldData?.getCreaterDateTime(),
        isGrey: isGrey, isAllowEmpty: true, isStart: true)); //创建日期
    children.add(UiBase.item(
        context,
        AppStrings.of(context).MaterialType,
        data?.getMaterialTypeName(context),
        oldData?.getMaterialTypeName(context),
        isGrey: isGrey,
        isAllowEmpty: true,
        isStart: true)); //物料类型
    children.add(UiBase.item(context, AppStrings.of(context).Address,
        data?.Address, oldData?.Address,
        isGrey: isGrey, isAllowEmpty: true, isStart: false)); //联系地址
    children.add(UiBase.item(context, AppStrings.of(context).LinkMan,
        data?.LinkMan, oldData?.LinkMan,
        isGrey: isGrey, isAllowEmpty: true, isStart: false)); //联系人
    children.add(UiBase.item(context, AppStrings.of(context).Telephone,
        data?.Telephone, oldData?.Telephone,
        isGrey: isGrey, isAllowEmpty: true, isStart: true)); //联系电话
    children.add(UiBase.item(
        context, AppStrings.of(context).Email3, data?.Email, oldData?.Email,
        isGrey: isGrey, isAllowEmpty: true, isStart: true)); //邮箱
    children.add(UiBase.item(context, AppStrings.of(context).CurrencyTypeName,
        data?.PriceUnitName, oldData?.PriceUnitName,
        isGrey: isGrey, isAllowEmpty: true, isStart: true)); //结算货币 1
    children.add(UiBase.item(context, AppStrings.of(context).Modeoftransport,
        data?.getTransportTypeName(context), oldData?.getTransportTypeName(context),
        isGrey: isGrey, isAllowEmpty: true, isStart: false)); //运输方式 1
    children.add(UiBase.item(context, AppStrings.of(context).TaxCode,
        data?.TaxcodeName, oldData?.TaxcodeName,
        isGrey: isGrey, isAllowEmpty: true, isStart: true)); //税码 1
    children.add(UiBase.item(context, AppStrings.of(context).TaxRate,
        data?.SuperelevationTaxRate, oldData?.SuperelevationTaxRate,
        unit: "%", isGrey: isGrey, isAllowEmpty: true, isStart: false)); //结算税率
    children.add(UiBase.item(context, AppStrings.of(context).Reconciliationtime,
        data?.getStatementDate(), oldData?.getStatementDate(),
        isGrey: isGrey, isAllowEmpty: true, isStart: true)); //对账时间
    children.add(UiBase.item(context, AppStrings.of(context).CompanyName2,
        data?.CompanyName, oldData?.CompanyName,
        isGrey: isGrey, isAllowEmpty: true, isStart: true)); //采购公司 1
    children.add(UiBase.item(context, AppStrings.of(context).Methodofallocation,
        data?.getShareTypeName(context), oldData?.getShareTypeName(context),
        isGrey: isGrey, isAllowEmpty: true, isStart: true)); //分摊方式
    children.add(UiBase.item(context, AppStrings.of(context).CompanyBank2,
        data?.CompanyBankName, oldData?.CompanyBankName,
        isGrey: isGrey, isAllowEmpty: true, isStart: false)); //开户行 1
    children.add(UiBase.item(context, AppStrings.of(context).BankAccount,
        data?.BankAccount, oldData?.BankAccount,
        isGrey: isGrey, isAllowEmpty: true, isStart: false)); //银行账号
    var column = UiBase.column(context, children);
    var card = UiCard.build(context, column);
    return card;
  }
}
